/**************************************************************

This file generates tables giving number of enrollment and graduates per discipline per year
It is then used to create Figure 1

**************************************************************/
capture log close
capture program drop _all
capture macro drop _all
drop _all
set more off

global stata_data 
global occ_data 
global output

***************************************************************

clear
use "${stata_data}finalched.dta", clear

gen year=substr(acadyear,1,4)
destring year, replace
drop acadyear

replace pscedgroup="89" if pscedgroup=="."
replace pscedgroup="89" if pscedgroup==""

replace pscedgroup="89" if pscedgroup=="46" | pscedgroup=="90" | pscedgroup=="47"	//This reclassifies some pscedgroups so that they are consistent across year
replace pscedgroup="0" if pscedgroup=="00"											

merge m:1 pscedgroup using "${occ_data}pscedmatch.dta", replace update
drop if _m==2
drop _m


***This section generates enrollment data for each discipline, separating out nursing

restore
gen nurse=1 if six_digitprogdis=="501200" & pscedgroup=="50"
replace nurse=1 if six_digitprogdis=="34" & pscedgroup=="50"
replace nurse=1 if six_digitprogdis=="500202" & pscedgroup=="50"
replace nurse=1 if six_digitprogdis=="503001" & pscedgroup=="50"
replace nurse=1 if six_digitprogdis=="509903" & pscedgroup=="50"
replace nurse=0 if nurse==.

replace pscedgroup="100" if nurse==1
replace disciplinegroup="Nursing" if nurse==1


*preserve
collapse (sum) emftotal, by(year pscedgroup disciplinegroup)
reshape wide emftotal, i(pscedgroup) j(year)
order disciplinegroup
save "${output}enrolltable_nursing", replace

restore
preserve
collapse (sum) gmftotal, by(year pscedgroup disciplinegroup)
reshape wide gmftotal, i(pscedgroup) j(year)
order disciplinegroup
save "${output}gradtable_nursing", replace

restore



